package com.ebank.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class BasicDao {
	public Connection conn;
	
	public Connection getConnection() throws SQLException{
		if (this.conn == null){
			
		try {
			Class.forName("com.mysql.jdbc.Driver");
			conn = DriverManager.getConnection("jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=Big5",
					"root","root");
			
			
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
			return conn;
		}else{
			return conn;
		}
	}
	
	public void disconnect() throws SQLException{
		conn.close();
	}
}
